package com.itqf.utils;

import com.itqf.entity.SysUser;
import org.apache.shiro.SecurityUtils;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2020/11/25
 * @Time: 下午2:54
 */
public class ShiroUtils {

    public  static void  setAttribute(String key,Object value){
        SecurityUtils.getSubject().getSession().setAttribute(key,value);
    }

    public  static Object  getAttribute(String key){
        return SecurityUtils.getSubject().getSession().getAttribute(key);
    }

    public static SysUser  getCurrentUser(){
       return (SysUser) SecurityUtils.getSubject().getPrincipal();
    }

    public static long  getCurrentUserId(){
        return getCurrentUser().getUserId();
    }




}
